<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    var a = [1,2,1,2,33,33,21];
    var b = [];
    for(var i = 0;i< a.length;i++){
        if(b.indexOf(a[i])== -1){
            b.push(a[i]);
        }
    };
    console.log(b);
    var a1 = [1,2,1,2,33,33,21];
    var newArr = [];
    var b1 = {};
    for(var i = 0;i< a.length;i++){
        if(!b1[a1[i]]){
            b1[a1[i]] = 1;
            newArr[newArr.length] = a1[i];
        }
    };
    console.log(newArr);
</script>
</body>
</html>